﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace customDgv
{
 public partial class Form1 : Form
 {
  public Form1()
  {
   InitializeComponent();
   ucMy1.zRegister(callback);
  }

  private void button1_Click(object sender, EventArgs e)
  {
   Random rnd = new Random();
   MyClass p = new MyClass(rnd.Next(5), rnd.Next(10));
   ucMy1.zAdd(p);
  }

  private void callback(MyClass p)
  {
   lblA.Text = p.a.ToString();
   lblB.Text = p.b.ToString();
  }

  private void button2_Click(object sender, EventArgs e)
  {
   ucMy1.zDel(ucMy1.Selected);
  }
 }
}
